package com.example.softarclab1.controller;

import com.example.softarclab1.middleware.MiddleWare;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class PublisherController {
    @PostMapping(value = "/publish")
    public String newPublish(@RequestBody Map<String, String> data) {
        final String pub_id = data.get("pub_id");
        final String topic = data.get("topic");
        final String message = data.get("message");

        MiddleWare.appendMQ(pub_id, topic, message);

        return "OK.";
    }
}
